﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Test
{
    public partial class FormModo : Form
    {
        private string user;

        public FormModo()
        {
            InitializeComponent();
            user = "";
        }

        private void firemanButton_Click(object sender, EventArgs e)
        {
            user = "Bombero";
            loadFormPrincipal(user);
        }

        private void commanderButton_Click(object sender, EventArgs e)
        {
            user = "Comandante";
            showLogForm();
        }

        private void loginButton_Click(object sender, EventArgs e)
        {
            if (userTextBox.Text.Equals("") || passTextBox.Text.Equals(""))
            {
                MessageBox.Show("Debe introducir usuario y contraseña");
                return;
            }
            loadFormPrincipal(user + " " + userTextBox.Text);
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            commanderButton.Visible = true;
            firemanButton.Visible = true;
            firebombButton.Visible = true;
            subtitleLabel.Text = "Seleccione su rol";
        }

        private void firebombButton_Click(object sender, EventArgs e)
        {
            user = "Carro";
            showLogForm();
        }

        private void loadFormPrincipal(string user)
        {
            FormPrincipal fp = new FormPrincipal(user, this);
            fp.Show();
            fp.Top = this.Top;
            fp.Left = this.Left;
            fp.Width = this.Width;
            fp.Height = this.Height;
            fp.Region = this.Region;
            this.Hide();

        }

        private void showLogForm()
        {
            commanderButton.Visible = false;
            firemanButton.Visible = false;
            firebombButton.Visible = false;
            passLabel.Visible = true;
            passTextBox.Visible = true;
            userLabel.Visible = true;
            userTextBox.Visible = true;
            loginLabel.Visible = true;
            loginButton.Visible = true;
            cancelButton.Visible = true;
            subtitleLabel.Text = "Ingrese sus datos";
        }

    }
}
